package com.weidft.dal.craft.dao.ibatis;

import java.util.List;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.weidft.dal.basedata.dataobject.HeatingDO;
import com.weidft.dal.craft.dao.HeatingDAO;

public class IBatisHeatingDAO extends SqlMapClientDaoSupport implements HeatingDAO{

	private static final String COUNT_ALL = "HEATING.countAll";
	private static final String DELETE_BY_ID = "HEATING.deleteById";
	private static final String FIND_BY_ID = "HEATING.findById";
	private static final String INSERT = "HEATING.insert";
	private static final String LIST_BY_QUERY = "HEATING.listByQuery";
	private static final String UPDATE = "HEATING.update";
	private static final String FIND_BY_HEATING_NO =  "HEATING.findByHeatingNo";
	
	public Integer countAll(HeatingDO query) {
		return (Integer)getSqlMapClientTemplate().queryForObject(COUNT_ALL, query);
	}

	public Integer deleteById(Integer id) {
		return (Integer)getSqlMapClientTemplate().delete(DELETE_BY_ID,id);
	}

	public HeatingDO findById(Integer id) {
		return (HeatingDO)getSqlMapClientTemplate().queryForObject(FIND_BY_ID,id);
	}

	public Integer insert(HeatingDO heatingDo) {
		return (Integer)getSqlMapClientTemplate().insert(INSERT,heatingDo);
	}

	@SuppressWarnings("unchecked")
	public List<HeatingDO> listByQuery(HeatingDO query) {
		return (List<HeatingDO>)getSqlMapClientTemplate().queryForList(LIST_BY_QUERY, query);
	}

	public Integer update(HeatingDO heatingDo) {
		return (Integer)getSqlMapClientTemplate().update(UPDATE,heatingDo);
	}

	public HeatingDO findByHeatingNo(String heatingNo) {
		return (HeatingDO)getSqlMapClientTemplate().queryForObject(FIND_BY_HEATING_NO,heatingNo);
	}
}
